package com.ruoyi.center.demo.api;

import com.ruoyi.center.demo.api.dto.DemoDto;
import com.ruoyi.common.core.dto.CommonResultDto;
import com.ruoyi.common.core.web.page.PageResultDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * Demo查询接口
 *
 * @author: wei.chen
 * @Date: 2022/2/15 16:16
 */
@Api(value = "Demo查询接口")
public interface DemoQueryApi {
    /**
     * 分页查询
     *
     * @param pageNum
     * @param pageSize
     * @param demoDto
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping("/page")
    CommonResultDto<PageResultDto<DemoDto>> queryPage(
            @NotNull(message = "页码[pageNum]不能为空") @RequestParam("pageNum") Long pageNum,
            @NotNull(message = "每页条数[pageSize]不能为空") @RequestParam("pageSize") Long pageSize,
            @RequestBody DemoDto demoDto);

    /**
     * 列表查询
     *
     * @param demoDto
     * @return
     */
    @ApiOperation(value = "列表查询", notes = "列表查询")
    @PostMapping("/list")
    CommonResultDto<List<DemoDto>> queryList(@RequestBody DemoDto demoDto);

    /**
     * 详情查询
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "详情查询", notes = "详情查询")
    @PostMapping("/detail/{id}")
    CommonResultDto<DemoDto> queryDetail(@PathVariable Long id);
}
